package me.snowiest.snowdrift.service.impl;

import me.snowiest.snowdrift.entity.Tag;
import me.snowiest.snowdrift.mapper.TagMapper;
import me.snowiest.snowdrift.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TagServiceImpl implements TagService {
    @Autowired
    private TagMapper tagMapper;

    @Override
    public void addTag(Tag tag) {
        tagMapper.insertTag(tag);
    }

    @Override
    public void removeTagById(Integer id) {
        tagMapper.deleteTagById(id);
    }

    @Override
    public void saveTag(Tag tag) {
        tagMapper.updateTag(tag);
    }

    @Override
    public Tag getTagById(Integer id) {
        return tagMapper.selectTagById(id);
    }

    @Override
    public List<Tag> getAllTag() {
        return tagMapper.selectAllTag();
    }
}
